/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Reeks5.VanRansbeeck.Kevin.View;

import Reeks5.VanRansbeeck.Kevin.Controller.ResetController;
import Reeks5.VanRansbeeck.Kevin.Model.HogerLagerModel;
import java.awt.event.ActionListener;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

/**
 *
 * @author sonicah
 */
public class HogerLagerMenuPaneel extends JPanel implements Observer {
    JMenuBar    menuBar     =   new JMenuBar();
    JMenu       fileMenu    =   new JMenu("File");
    JMenuItem   resetMenu   =   new JMenuItem("Start Over");

    protected   HogerLagerModel model;

    public HogerLagerMenuPaneel(HogerLagerModel model) {
        super();
        this.model = model;
        ActionListener resetListener = new ResetController(this.model);

        this.menuBar.add(fileMenu);
        this.fileMenu.add(resetMenu);

        this.resetMenu.addActionListener(resetListener);

        this.add(menuBar);
    }

    public void update(Observable o, Object arg) {
        this.model.setAantal_gokken(0);
        this.model.generateRandomNumber();
    }
}
